home *** CD-ROM | disk | FTP | other *** search
/ Palm Utilities / Palm_Utilities_CD-ROM_2001_2001.iso / files / utils misc / Bachmann Print Manager 2.01b / BachmannPrintManager.exe / SamplePrints / Incs / PrintMgr.h < prev    next >
Encoding:
C/C++ Source or Header  |  1999-05-19  |  7.6 KB  |  237 lines

  1. /***********************************************************************
  2.  *
  3.  * Copyright ⌐ 1998, Bachmann Software and Services.
  4.  * All rights reserved.
  5.  *
  6.  * FileName:
  7.  *        PrintMgr.h
  8.  *
  9.  * Description:
  10.  *        Print Manager library API definitions.  The Print Manager library
  11.  *        provides graphical printing for the Palm Computing Platform.
  12.  *
  13.  * History:
  14.  *       12/14/98    Greg Winton    Created file.
  15.  *
  16.  *    12/21/98    Greg Winton    Added functions:
  17.  *                               -  PrnDrawBitmap
  18.  *                               -  PrnGetPageExtent
  19.  *                               -  PrnGetPattern
  20.  *                               -  PrnSetPattern
  21.  *                               -  PrnSetUnderlineMode
  22.  *
  23.  *    12/22/98    Greg Winton    Added functions:
  24.  *                               -  PrnGetAverageCharWidth
  25.  *                               -  PrnGetCharHeight
  26.  *                               -  PrnGetCharWidth
  27.  *                               -  PrnGetCharsInWidth
  28.  *                               -  PrnGetCharsWidth
  29.  *
  30.  *******************************************************************/
  31.  
  32. #ifndef __PRINT_MGR_H__
  33. #define __PRINT_MGR_H__
  34.  
  35. // If we're actually compiling the library code, then we need to
  36. // eliminate the trap glue that would otherwise be generated from
  37. // this header file in order to prevent compiler errors in CW Pro 2.
  38. #ifdef BUILDING_PRINT_MGR
  39.     #define PRINT_MGR_TRAP(trapNum)
  40. #else
  41.     #define PRINT_MGR_TRAP(trapNum) SYS_TRAP(trapNum)
  42. #endif
  43.  
  44.  
  45. // PalmPilot common definitions
  46. #include <Common.h>
  47. #include <SystemMgr.rh>
  48.  
  49. // PrintMgr Definitions
  50. #include <PrintMgrDefines.h>
  51.  
  52. //-----------------------------------------------------------------------------
  53. // Print Manager library function trap ID's. Each library call gets a trap number:
  54. //   prnTrapXXXX which serves as an index into the library's dispatch table.
  55. //   The constant sysLibTrapCustom is the first available trap number after
  56. //   the system predefined library traps Open,Close,Sleep & Wake.
  57. //
  58. // WARNING!!! The order of these traps MUST match the order of the dispatch
  59. //  table in SampleLibDispatch.c!!!
  60. //-----------------------------------------------------------------------------
  61.  
  62. typedef enum {
  63.     prnTrapGetLibAPIVersion = sysLibTrapCustom,
  64.    prnTrapDrawBitmap,
  65.     prnTrapDrawChars,
  66.     prnTrapDrawGrayLine,
  67.    prnTrapDrawGrayRectangle,
  68.    prnTrapDrawGrayRectangleFrame,
  69.     prnTrapDrawLine,
  70.    prnTrapDrawRectangle,
  71.    prnTrapDrawRectangleFrame,
  72.    prnTrapDrawText,
  73.    prnTrapFillRectangle,
  74.    prnTrapGetFont,
  75.    prnTrapGetPageExtent,
  76.    prnTrapGetPattern,
  77.    prnTrapGetUnderlineMode,
  78.    prnTrapNewPage,
  79.    prnTrapSetFont,
  80.    prnTrapSetOrientation,
  81.    prnTrapSetPattern,
  82.    prnTrapSetUnderlineMode,
  83.  
  84.    prnTrapGetAverageCharWidth,
  85.    prnTrapGetCharHeight,
  86.    prnTrapGetCharWidth,
  87.    prnTrapGetCharsInWidth,
  88.    prnTrapGetCharsWidth,
  89.  
  90.    prnTrapWrite,
  91.  
  92.     prnTrapLast
  93.     } PrintMgrTrapNumberEnum;
  94.  
  95. /********************************************************************
  96.  * API Prototypes
  97.  ********************************************************************/
  98.  
  99. #ifdef __cplusplus
  100. extern "C" {
  101. #endif
  102.  
  103. //--------------------------------------------------
  104. // Standard library open, close, sleep and wake functions
  105. //--------------------------------------------------
  106.  
  107. extern Err PrnOpen(UInt refNum, CharPtr printerName, CharPtr portName)
  108.                 PRINT_MGR_TRAP(sysLibTrapOpen);
  109.                 
  110. extern Err PrnClose(UInt refNum)
  111.                 PRINT_MGR_TRAP(sysLibTrapClose);
  112.  
  113. extern Err PrnSleep(UInt refNum)
  114.                 PRINT_MGR_TRAP(sysLibTrapSleep);
  115.  
  116. extern Err PrnWake(UInt refNum)
  117.                 PRINT_MGR_TRAP(sysLibTrapWake);
  118.  
  119.  
  120. //--------------------------------------------------
  121. // Custom library API functions
  122. //--------------------------------------------------
  123.     
  124. // Get our library API version
  125. extern Err PrnGetLibAPIVersion(UInt refNum, DWordPtr dwVerP)
  126.                 PRINT_MGR_TRAP(prnTrapGetLibAPIVersion);
  127.  
  128. // Draw bitmap
  129. extern Err PrnDrawBitmap(UInt refNum, BitmapPtr bitmapP, SWord x, SWord y)
  130.                 PRINT_MGR_TRAP(prnTrapDrawBitmap);
  131.                 
  132. // Draw chars
  133. extern Err PrnDrawChars(UInt refNum, CharPtr chars, Word len, SWord x, SWord y)
  134.                 PRINT_MGR_TRAP(prnTrapDrawChars);
  135.                 
  136. // Draw gray line
  137. extern Err PrnDrawGrayLine(UInt refNum, SWord x1, SWord y1, SWord x2, SWord y2)
  138.                 PRINT_MGR_TRAP(prnTrapDrawGrayLine);
  139.                 
  140. // Draw gray rectangle
  141. extern Err PrnDrawGrayRectangle (UInt refNum, RectanglePtr r, Word cornerDiam)
  142.                 PRINT_MGR_TRAP(prnTrapDrawGrayRectangle);
  143.  
  144. // Draw gray rectangle frame
  145. extern Err PrnDrawGrayRectangleFrame (UInt refNum, RectanglePtr r)
  146.                 PRINT_MGR_TRAP(prnTrapDrawGrayRectangleFrame);
  147.  
  148. // Draw line
  149. extern Err PrnDrawLine (UInt refNum, SWord x1, SWord y1, SWord x2, SWord y2)
  150.                 PRINT_MGR_TRAP(prnTrapDrawLine);
  151.  
  152. // Draw rectangle
  153. extern Err PrnDrawRectangle (UInt refNum, RectanglePtr r, Word cornerDiam)
  154.                 PRINT_MGR_TRAP(prnTrapDrawRectangle);
  155.  
  156. // Draw rectangle frame
  157. extern Err PrnDrawRectangleFrame (UInt refNum, RectanglePtr r)
  158.                 PRINT_MGR_TRAP(prnTrapDrawRectangleFrame);
  159.  
  160. // Draw text
  161. extern Err PrnDrawText (UInt refNum, CharPtr text, Word len, RectanglePtr r, UInt flags)
  162.                 PRINT_MGR_TRAP(prnTrapDrawText);
  163.  
  164. // Fill rectangle
  165. extern Err PrnFillRectangle (UInt refNum, RectanglePtr r, Word cornerDiam)
  166.                 PRINT_MGR_TRAP(prnTrapFillRectangle);
  167.  
  168. // Get current font
  169. extern Err PrnGetFont (UInt refNum, PrnFontPtr fontP)
  170.                 PRINT_MGR_TRAP(prnTrapGetFont);
  171.  
  172. // Get extent of printed page
  173. extern Err PrnGetPageExtent (UInt refNum, SWordPtr extentX, SWordPtr extentY)
  174.             PRINT_MGR_TRAP(prnTrapGetPageExtent);
  175.  
  176. // Get current fill pattern
  177. extern Err PrnGetPattern (UInt refNum, CustomPatternType pattern)
  178.             PRINT_MGR_TRAP(prnTrapGetPattern);
  179.  
  180. // Get underline mode
  181. extern Err PrnGetUnderlineMode (UInt refNum, UnderlineModeType* modeP)
  182.             PRINT_MGR_TRAP(prnTrapGetUnderlineMode);
  183.  
  184. // Start a new printed page
  185. extern Err PrnNewPage (UInt refNum)
  186.                 PRINT_MGR_TRAP(prnTrapNewPage);
  187.  
  188. // Set font
  189. extern Err PrnSetFont (UInt refNum, PrnFontPtr fontP)
  190.                 PRINT_MGR_TRAP(prnTrapSetFont);
  191.  
  192. // Set printer orientation
  193. extern Err PrnSetOrientation (UInt refNum, PrnOrientEnum orient)
  194.                 PRINT_MGR_TRAP(prnTrapSetOrientation);
  195.  
  196. // Set fill pattern
  197. extern Err PrnSetPattern (UInt refNum, CustomPatternType pattern)
  198.             PRINT_MGR_TRAP(prnTrapSetPattern);
  199.  
  200. // Set underline mode
  201. extern Err PrnSetUnderlineMode (UInt refNum, UnderlineModeType mode)
  202.             PRINT_MGR_TRAP(prnTrapSetUnderlineMode);
  203.  
  204. extern Err PrnGetAverageCharWidth (UInt refNum, Int* widthP)
  205.             PRINT_MGR_TRAP(prnTrapGetAverageCharWidth);
  206.  
  207. extern Err PrnGetCharHeight (UInt refNum, Int* heightP)
  208.             PRINT_MGR_TRAP(prnTrapGetCharHeight);
  209.  
  210. extern Err PrnGetCharWidth (UInt refNum, Char ch, Int* widthP)
  211.             PRINT_MGR_TRAP(prnTrapGetCharWidth);
  212.  
  213. extern Err PrnGetCharsInWidth (UInt refNum, CharPtr string, Int *stringWidthP, Int *stringLengthP, Boolean *fitWithinWidth)
  214.             PRINT_MGR_TRAP(prnTrapGetCharsInWidth);
  215.  
  216. extern Err PrnGetCharsWidth (UInt refNum, CharPtr chars, Word len, Int* widthP)
  217.             PRINT_MGR_TRAP(prnTrapGetCharsWidth);
  218.  
  219. extern Err PrnWrite (UInt refNum, BytePtr bytes, Word len)
  220.             PRINT_MGR_TRAP(prnTrapWrite);
  221.  
  222. // For loading the library in PalmPilot Mac emulation mode
  223. extern Err PrnInstall(UInt refNum, SysLibTblEntryPtr entryP);
  224.  
  225. #ifdef __cplusplus 
  226. }
  227. #endif
  228.  
  229. /********************************************************************
  230.  * Public Macros
  231.  ********************************************************************/
  232.  
  233.  
  234.  
  235.  
  236. #endif    // __PRINT_MGR_H__
  237.